<?php
/**
 * @Author: xuzhiyi
 * @Date:   2016-02-16 20:57:18
 * @Last Modified by:   xuzhiyi
 * @Last Modified time: 2016-02-29 16:59:20
 * ------------------------------------------------ *
 * 商品评价                                          *
 * ------------------------------------------------ */

namespace Admin\Controller;
class GoodsAppraisesController extends CommonController {

	public function index(){
		if(IS_AJAX){
			switch(I('ajax')){				
				case "del":
					$status = D('GoodsAppraises')->delGoodsAppraises();
					$this->ajaxReturn($status);
					break;
				case "edit":
					$status = D('GoodsAppraises')->editGoodsAppraises();
					$this->ajaxReturn($status);
			}
		}

		
		$m = D('GoodsAppraises');
    	$PQ = $m->getGoodsAppraises();
    	$pageSize=(int)I('pageSize',0);
    	if($pageSize>0) $PQ['pageSize']=$pageSize;

    	$page= getPage($PQ['total'],$PQ['pageSize']);   	
    	$PQ['page'] = $page->show();
    	$this->assign('PQ',$PQ);
    	$this->assign('shopName',I('shopName'));
    	$this->assign('goodsName',I('goodsName'));
		$this->display();
	}



//跳到编辑界面

	public function edit(){		
		$m = D('Goods_appraises');
		if(I('id')>0){
			$object = $m->get();
			//dump($object);
			$this->assign('object',$object);
		}
		$this->display();
	}
}